import Me from '@/dll/me'

export default {
  data () {
    return {
      invoiceInfo: {}, // 发票信息
      invoiceDetail: {},
      validate: false, // 发票是否填写完成
      list: [],
      taxpayerIdentificationReg: /^[0-9a-zA-Z]{5,24}$/, // 纳税人识别号正则
      bankReg: /^[0-9]{15,19}$/ // 银行账号正则
    }
  },

  // activated () {
  // this.getInvoiceList()
  // },

  computed: {
    isDefault () {
      return (index) => {
        return parseFloat(this.list[index].is_default) === 1
      }
    }
  },

  methods: {
    // 获取发票列表
    async getInvoiceList () {
      this.$vux.loading.show({
        text: '加载中'
      })
      let res = await Me.getIssueInfo(2)
      this.$vux.loading.hide()
      if (res.code == 0) {
        this.list = res.data
      }
    }
  }
}
